var express = require('express');

var router = express.Router();

router.get('/', function(req, res) {
  console.log("router middleware");

  res.setHeader('Content-Type', 'text/html') // 只能单个，如果用set则可以设置多个:
  /* res.set({
    'X-Custom-Header': 'CustomHeaderValue',
    'Cache-Control': 'no-cache, no-store, must-revalidate'
  }); */
  console.log(req.params.id)
  res.status(201).send(['apple', 'banana', 'orange']);
  //res.end();
});

router.post('/', function(req, res) {
  res.send('Hello World! POST');
});

router.put('/', function(req, res) {
  res.send('Hello World! PUT');
});

router.delete('/', function(req, res) {
  res.send('Hello World! DELETE');
});

module.exports = router;